<?php

// +----------------------------------------------------------------------
// | H1CMS © OpenSource CMS
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2016 http://www.h1cms.com All rights reserved.
// | Copyright (c) 2014-2016 嘉兴领格信息技术有限公司，并保留所有权利。
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Allen <allen@lg4.cn>
// +----------------------------------------------------------------------


class AddUserValidator extends \Lg\Validation\Validator {

    public function rules() {
        return [
            'required' => [
                ['user.display_name'],
                ['username'],
                ['email'],
                ['password'],
                ['repassword']
            ],
            'lengthBetween' => [
                ['username' => [5, 20]]
            ],
            'equals'=>[
                ['password','repassword']
            ]
        ];
    }
    

    public function attributes() {
        return [
            'username' => '用户名',
            'email' => 'Email地址',
            'password' => '密码',
            'repassword'=> '再次输入密码',
            'user.display_name'=>'昵称'
        ];
    }

}
